using System;
//using System.Runtime.Serialization;
using System.Xml.Serialization;

namespace SpellingQuiz
{
	/// <summary>
	/// Summary description for SpellingEntry.
	/// </summary>
	[Serializable()]
	public class SpellingEntry
	{
		private string spellingWordValue;
		private string pronunciationValue;
		private string contextPhraseValue;
        private string soundRecordingValue;

        [XmlIgnore]
        public byte[] SoundRecordingBytes
        {
            get
            {
                if (soundRecordingValue == null) return new byte[0];
                else return Convert.FromBase64String(soundRecordingValue);
            }
            set
            {
                soundRecordingValue = Convert.ToBase64String(value);
            }
            
        }

        public string SoundRecording
        {
            get
            {
                return soundRecordingValue;
            }
            set
            {
                soundRecordingValue = value;
            }
        }

		public SpellingEntry()
		{
		}

		public SpellingEntry( string spellingWord )
		{
			this.SpellingWord = spellingWord;
		}

		public SpellingEntry( string spellingWord, string pronunciation, string contextPhrase )
		{
			this.SpellingWord = spellingWord;
			this.Pronunciation = pronunciation;
			this.ContextPhrase = contextPhrase;
		}

		public string SpellingWord
		{
			get{ return spellingWordValue; }
			set{ spellingWordValue = value; }
		}

		public string Pronunciation
		{
			get{ return pronunciationValue; }
			set{ pronunciationValue = value; }
		}

		public string ContextPhrase
		{
			get{ return contextPhraseValue; }
			set{ contextPhraseValue = value; }
		}

		public override string ToString()
		{
			return SpellingWord;
		}

	}
}
